<?php
error_reporting(E_ALL); 
ini_set("display_errors", 1); 
 

//optional code in neo22s.com/filecache
include 'fileCache.php';
//file wrapper cache example
include 'wrapperCache.php';


//creating new instance singleton
$cache = wrapperCache::GetInstance('filecache',360000,'cache/');//all params are optional
//or set it in auto and the class will choose the cache engine for you ;)
//$cache = wrapperCache::GetInstance('auto');

//caching values
$cache->thevar='I\'m the bar from wrapper cache using filecache';//overload of set and get methods
//or:
$cache->cache('thevar','test values for the var!!!!');

//retrieving value for a key
echo $cache->thevar;//get
//or:
echo $cache->cache('thevar');//get

//isset and unset are overloaded
var_dump(isset($cache->thevar));
//unset($cache->thevar);

//displays availables cache engines in your system:
//echo $cache->getAvailableCache();

//flush all cache
//$cache->clearCache();



//example to add multiple servers of memcache
/*$memcache_servers = 
		array (
				array('host'=>'localhost','port'=>11211),
				array('host'=>'172.16.0.3')
		);

$cache = wrapperCache::GetInstance('memcache',30, $memcache_servers );//creating new instance singleton*/
/*
//or simpler way:
$cache = wrapperCache::GetInstance('memcache',30,array(array('host'=>'localhost')));

if ($cache->site==null){
	echo 'inside';
	$cache->cache('site',strip_tags(file_get_contents("http://yahoo.com")),100);//time overload
}
echo $cache->site;

//end wrapper cache example
*/
?>